# -*- coding: utf-8 -*-
from __future__ import print_function, division
#系统库
import md5
#第三方库

#自定义库
import database


def register(username, password, email):
    password = md5.new(password).hexdigest()
    return database.DB.register(username, password, email)


def login(username, password):
    password = md5.new(password).hexdigest()
    userinfo, code, errormsg = database.DB.login(username, password)
    return userinfo, code, errormsg
